package com.smile.ye.http;
import com.smile.ye.data.dto.AuthLoginDto;
import com.smile.ye.data.dto.AuthRegisterDto;
import com.smile.ye.response.Result;
import com.smile.ye.service.AuthService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Api("授权")
@RequestMapping("/auth")
public class AuthController {
    @Autowired
    AuthService service;

    @PostMapping("/login")
    public Result login(@RequestBody AuthLoginDto dto){
        return service.login(dto);
    }
    @PostMapping("/code/{email}")
    public Result code(@PathVariable String email){
        return service.code(email);
    }
    @PostMapping("/register")
    public Result register(@RequestBody AuthRegisterDto dto){
        System.out.println(dto);
        return service.register(dto);
    }


    @GetMapping("/store")
    public Result queryStore(){
        return  service.queryStore();
    }

}
